package work9;

import java.util.Random;

class Poker<C, P> {//定义泛型类Poker
	C c;
	P p;
	Poker(C c,P p){
		this.c = c;
		this.p = p;//构造方法初始化
	}


	public String gets(){

		return c+":"+p;//返回C和P的两个toString()组合
	}

}

class Color {

	public String toString() { //重写toString()
		String[] s = new String[]{"方块", "梅花", "红桃", "黑桃"}; //随机生成1到4的整数
		Random r = new Random();
		int number=r.nextInt(4);
		return  s[number];
	}
}
class Point {

	public String toString() { //重写toString()
		String str;
		Random r = new Random();
		String[] s= new String[]{"1", "2", "3", "4","5","6","7","8","9","10","J","Q","K"}; //随机生成1到4的整数
		int number=r.nextInt(s.length);
		return  s[number];
	}

}

public class t1 {
	public static void main(String[] args) {
		Color color = new Color();
		Point point = new Point();
		String str;
		for(int i=1;i<=5;i++){
			str = color+ ":" +point;
			System.out.println("随机生成："+str);//生成并打印出一张牌
		}
		System.out.println("\n0501刘冰");
	}
}